import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/utils/cash_utils.dart';
import 'package:finance_app/src/widgets/common/tag_widget.dart';
import 'package:finance_app/src/widgets/select/mixin/check_box_mixin.dart';
import 'package:finance_app/src/widgets/wrapper/normal_form_wrapper.dart';
import 'package:flutter/material.dart';

class ReimburseItemCheckBox extends StatelessWidget with CheckBoxMixin {
  final String name;
  final String title;
  final String time;
  final String status;
  final String currency;
  final num amount;
  final bool isSelect;
  final bool isEnable;

  const ReimburseItemCheckBox(
      {Key key,
      this.isSelect,
      this.isEnable = true,
      this.name,
      this.title,
      this.time,
      this.status,
      this.currency,
      this.amount})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: getDp(100),
      child: NormalFormWrapper(
        leftPadding: getDp(28),
        rightPadding: getDp(35),
        topPadding: getDp(21),
        backgroundColor: isSelect ? aceLightBlue : null,
        hasBottomBorder: true,
        child: Row(
          children: [
            buildSelectWidget,
            SizedBox(
              width: getDp(23),
            ),
            Expanded(
              child: Stack(
                clipBehavior: Clip.none,
                children: [
                  Positioned(
                    top: 0,
                    bottom: 0,
                    left: 0,
                    child: Column(
                      mainAxisSize: MainAxisSize.min,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        SizedBox(
                          width: getDp(160),
                          child: Text(
                            name,
                            style: TextStyle(
                              color: aceBlackColor,
                              fontSize: getSp(18),
                              fontWeight: FontWeight.w700,
                              height: 16 / 18,
                            ),
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis,
                          ),
                        ),
                        SizedBox(
                          height: getDp(4),
                        ),
                        SizedBox(
                          width: getDp(140),
                          child: Text(
                            title,
                            style: TextStyle(
                              color: aceBlueColor,
                              fontSize: getSp(16),
                              fontWeight: FontWeight.w700,
                              height: 14 / 16,
                            ),
                            maxLines: 1,
                          ),
                        ),
                        SizedBox(
                          height: getDp(4),
                        ),
                        Text(
                          time,
                          style: TextStyle(
                            color: aceDarkGrayColor,
                            fontSize: getSp(16),
                            fontWeight: FontWeight.w400,
                            height: 14 / 16,
                          ),
                        ),
                      ],
                    ),
                  ),
                  Positioned(
                    top: 0,
                    bottom: 0,
                    right: 0,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      mainAxisSize: MainAxisSize.min,
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: [
                        if (status != null)
                          status == 'Upcoming'
                              ? BlueTagWidget(
                                  content: status,
                                )
                              : RedTagWidget(
                                  content: status,
                                ),
                        SizedBox(
                          height: getDp(9),
                        ),
                        Text(
                          '$currency ${CashUtils.formatCashAmount(amount)}',
                          style: TextStyle(
                            color: aceBlackColor,
                            fontSize: getSp(16),
                            fontWeight: FontWeight.w700,
                            height: 14 / 16,
                          ),
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
